<script>
    // 实现 alert(add(1)(2)(3)(4)(5))

    function add(x) {
        let sum = x; // sum是存储和
        let tmp = function (y) {
            sum = sum + y;
            return tmp;
        }
        tmp.toString = function(){
            return sum;
        }
        return tmp;
    }

    // 当alert时，会调用toString方法
    alert(add(1)(2)(3)(4)(5))
</script>